﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Pinger
{
	public partial class HostForm : Form
	{
		public Host Host{ get; set; }

		public HostForm(Host host)
		{
			InitializeComponent();
			InitHostToForm(host);
		}

		private void HostForm_Load(object sender, EventArgs e)
		{
			txtName.Focus();
		}

		private void InitHostToForm(Host host)
		{
			this.Host = host;
			txtName.Text = host.Name;
			txtDescription.Text = host.Description;
		}

		private void UpdateHostFromForm(Host host)
		{
			host.Name = txtName.Text;
			host.Description = txtDescription.Text;
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			UpdateHostFromForm(Host);
			DialogResult = DialogResult.OK;
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			DialogResult = DialogResult.Cancel;
		}

	}
}
